package com.xiaoxiong.mami.dao.mapper;

import com.xiaoxiong.mami.dao.daomain.OrderInfo;
import org.apache.ibatis.jdbc.SQL;

public class OrderInfoSqlProvider {

    public String insertSelective(OrderInfo record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("order_info");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=BIGINT}");
        }
        
        if (record.getOrderId() != null) {
            sql.VALUES("orderId", "#{orderId,jdbcType=VARCHAR}");
        }
        
        if (record.getOrderType() != null) {
            sql.VALUES("orderType", "#{orderType,jdbcType=VARCHAR}");
        }
        
        if (record.getOrderTitle() != null) {
            sql.VALUES("orderTitle", "#{orderTitle,jdbcType=VARCHAR}");
        }
        
        if (record.getOrderDescribe() != null) {
            sql.VALUES("orderDescribe", "#{orderDescribe,jdbcType=VARCHAR}");
        }
        
        if (record.getOrderAddress() != null) {
            sql.VALUES("orderAddress", "#{orderAddress,jdbcType=VARCHAR}");
        }
        
        if (record.getPayType() != null) {
            sql.VALUES("payType", "#{payType,jdbcType=VARCHAR}");
        }
        
        if (record.getOrderStatus() != null) {
            sql.VALUES("orderStatus", "#{orderStatus,jdbcType=VARCHAR}");
        }
        
        if (record.getTotalMoney() != null) {
            sql.VALUES("totalMoney", "#{totalMoney,jdbcType=VARCHAR}");
        }
        
        if (record.getUserId() != null) {
            sql.VALUES("userId", "#{userId,jdbcType=VARCHAR}");
        }
        
        if (record.getReceiver() != null) {
            sql.VALUES("receiver", "#{receiver,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.VALUES("createTime", "#{createTime,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.VALUES("updateTime", "#{updateTime,jdbcType=VARCHAR}");
        }
        
        if (record.getTelephone() != null) {
            sql.VALUES("telephone", "#{telephone,jdbcType=VARCHAR}");
        }
        
        if (record.getOrderIdentifier() != null) {
            sql.VALUES("orderIdentifier", "#{orderIdentifier,jdbcType=VARCHAR}");
        }
        
        if (record.getStatusName() != null) {
            sql.VALUES("statusName", "#{statusName,jdbcType=VARCHAR}");
        }
        
        if (record.getDealUserId() != null) {
            sql.VALUES("dealUserId", "#{dealUserId,jdbcType=VARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(OrderInfo record) {
        SQL sql = new SQL();
        sql.UPDATE("order_info");
        
        if (record.getOrderId() != null) {
            sql.SET("orderId = #{orderId,jdbcType=VARCHAR}");
        }
        
        if (record.getOrderType() != null) {
            sql.SET("orderType = #{orderType,jdbcType=VARCHAR}");
        }
        
        if (record.getOrderTitle() != null) {
            sql.SET("orderTitle = #{orderTitle,jdbcType=VARCHAR}");
        }
        
        if (record.getOrderDescribe() != null) {
            sql.SET("orderDescribe = #{orderDescribe,jdbcType=VARCHAR}");
        }
        
        if (record.getOrderAddress() != null) {
            sql.SET("orderAddress = #{orderAddress,jdbcType=VARCHAR}");
        }
        
        if (record.getPayType() != null) {
            sql.SET("payType = #{payType,jdbcType=VARCHAR}");
        }
        
        if (record.getOrderStatus() != null) {
            sql.SET("orderStatus = #{orderStatus,jdbcType=VARCHAR}");
        }
        
        if (record.getTotalMoney() != null) {
            sql.SET("totalMoney = #{totalMoney,jdbcType=VARCHAR}");
        }
        
        if (record.getUserId() != null) {
            sql.SET("userId = #{userId,jdbcType=VARCHAR}");
        }
        
        if (record.getReceiver() != null) {
            sql.SET("receiver = #{receiver,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.SET("createTime = #{createTime,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.SET("updateTime = #{updateTime,jdbcType=VARCHAR}");
        }
        
        if (record.getTelephone() != null) {
            sql.SET("telephone = #{telephone,jdbcType=VARCHAR}");
        }
        
        if (record.getOrderIdentifier() != null) {
            sql.SET("orderIdentifier = #{orderIdentifier,jdbcType=VARCHAR}");
        }
        
        if (record.getStatusName() != null) {
            sql.SET("statusName = #{statusName,jdbcType=VARCHAR}");
        }
        
        if (record.getDealUserId() != null) {
            sql.SET("dealUserId = #{dealUserId,jdbcType=VARCHAR}");
        }
        
        sql.WHERE("id = #{id,jdbcType=BIGINT}");
        
        return sql.toString();
    }
}